{include="header"}

<script type="text/javascript">
   $(document).ready(function() {
      $("#b_nuevo_agente").click(function(event) {
         event.preventDefault();
         $("#modal_nuevo_agente").modal('show');
         document.f_nuevo_agente.snombre.focus();
      });
   });
</script>

<div class="table-responsive">
   <table class="table table-hover">
      <thead>
         <tr>
            <th class="text-left">Código + Nombre + Apellidos</th>
            <th class="text-left">{#FS_CIFNIF#}</th>
            <th class="text-left">Teléfono</th>
            <th class="text-right">Email</th>
         </tr>
      </thead>
      {loop="$fsc->agente->all()"}
      <tr class="clickableRow" href="{$value->url()}">
         <td>
            <a href="{$value->url()}">{$value->codagente}</a> {$value->get_fullname()}
         </td>
         <td>{$value->dnicif}</td>
         <td>{if condition="$value->telefono==''"}-{else}{$value->telefono}{/if}</td>
         <td class="text-right">{if condition="$value->email==''"}-{else}{$value->email}{/if}</td>
      </tr>
      {/loop}
   </table>
</div>

<form class="form-horizontal" role="form" name="f_nuevo_agente" action="{$fsc->url()}" method="post">
   <div class="modal" id="modal_nuevo_agente">
      <div class="modal-dialog">
         <div class="modal-content">
            <div class="modal-header">
               <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
               <h4 class="modal-title">Nuevo empleado</h4>
            </div>
            <div class="modal-body">
               <div class="form-group">
                  <label for="snombre" class="col-lg-2 col-md-2 col-sm-2 control-label">Nombre</label>
                  <div class="col-lg-10 col-md-10 col-sm-10">
                     <input class="form-control" type="text" name="snombre" autocomplete="off"/>
                  </div>
               </div>
               <div class="form-group">
                  <label for="sapellidos" class="col-lg-2 col-md-2 col-sm-2 control-label">Apellidos</label>
                  <div class="col-lg-10 col-md-10 col-sm-10">
                     <input class="form-control" type="text" name="sapellidos" autocomplete="off"/>
                  </div>
               </div>
               <div class="form-group">
                  <label for="sdnicif" class="col-lg-2 col-md-2 col-sm-2 control-label">{#FS_CIFNIF#}</label>
                  <div class="col-lg-10 col-md-10 col-sm-10">
                     <input class="form-control" type="text" name="sdnicif" autocomplete="off"/>
                  </div>
               </div>
               <div class="form-group">
                  <label for="stelefono" class="col-lg-2 col-md-2 col-sm-2 control-label">Teléfono</label>
                  <div class="col-lg-10 col-md-10 col-sm-10">
                     <input class="form-control" type="text" name="stelefono" autocomplete="off"/>
                  </div>
               </div>
               <div class="form-group">
                  <label for="semail" class="col-lg-2 col-md-2 col-sm-2 control-label">Email</label>
                  <div class="col-lg-10 col-md-10 col-sm-10">
                     <input class="form-control" type="text" name="semail" autocomplete="off"/>
                  </div>
               </div>
            </div>
            <div class="modal-footer">
               <button class="btn btn-sm btn-primary" type="submit" onclick="this.disabled=true;this.form.submit();">
                  <span class="glyphicon glyphicon-floppy-disk"></span> &nbsp; Guardar
               </button>
            </div>
         </div>
      </div>
   </div>
</form>

{include="footer"}